package com.baiyun.service.impl;

import com.baiyun.entity.Inventory;
import com.baiyun.mapper.InventoryMapper;
import com.baiyun.service.InventoryService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class InventoryServiceImpl implements InventoryService {

    private final InventoryMapper inventoryMapper;

    /**
     * 查询所有库存信息
     * @return
     */
    @Override
    public List<Inventory> selectAllInventory() {
        return inventoryMapper.selectAllInventory();
    }

    /**
     * 更新库存信息
     */
    @Override
    public void updateInventory(Inventory inventory) {
        inventoryMapper.updateInventory(inventory);
    }

    /**
     * 添加库存信息
     * @param inventory
     */
    @Override
    public void addInventory(Inventory inventory) {
        inventoryMapper.addInventory(inventory);
    }

    /**
     * 删除库存信息
     * @param id
     */
    @Override
    public void deleteInventory(Integer id) {
        inventoryMapper.deleteInventory(id);
    }

    /**
     * 根据名称查询库存信息
     * @param tname
     * @return
     */
    @Override
    public List<Inventory> selectInventoryByName(String tname) {
        return inventoryMapper.selectInventoryByName(tname);
    }

    /**
     * 根据tid查询库存信息
     * @param tid
     */
    @Override
    public Inventory selectInventoryByTid(Integer tid) {
        return inventoryMapper.selectInventoryByTid(tid);
    }
}
